package JHfstools;

import java.awt.EventQueue;

import javax.swing.JDialog;
import java.awt.Color;
import javax.swing.SpringLayout;
import javax.swing.JTextArea;
import javax.swing.JButton;
import javax.swing.ImageIcon;
import javax.swing.border.TitledBorder;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Dimension;

@SuppressWarnings("serial")
public class hftrendlg extends JDialog {
	private JTextArea hftnewnamebox;
	boolean isok = false;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					hftrendlg dialog = new hftrendlg();
					dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
					dialog.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the dialog.
	 * @return 
	 */
	public hftrendlg() {
		setSize(new Dimension(380, 160));
		setPreferredSize(new Dimension(380, 160));
		setMinimumSize(new Dimension(380, 160));
		setModal(true);
		getContentPane().setBackground(new Color(245, 255, 250));
		SpringLayout springLayout = new SpringLayout();
		getContentPane().setLayout(springLayout);
		hftnewnamebox = new JTextArea();
		springLayout.putConstraint(SpringLayout.NORTH, hftnewnamebox, 10, SpringLayout.NORTH, getContentPane());
		springLayout.putConstraint(SpringLayout.WEST, hftnewnamebox, 10, SpringLayout.WEST, getContentPane());
		springLayout.putConstraint(SpringLayout.SOUTH, hftnewnamebox, 62, SpringLayout.NORTH, getContentPane());
		springLayout.putConstraint(SpringLayout.EAST, hftnewnamebox, 362, SpringLayout.WEST, getContentPane());
		hftnewnamebox.setBorder(new TitledBorder(null, "New name:", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		getContentPane().add(hftnewnamebox);
		
		JButton hftrenokbtn = new JButton("");
		hftrenokbtn.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				setVisible(false);
				}
		});
		springLayout.putConstraint(SpringLayout.WEST, hftrenokbtn, 10, SpringLayout.WEST, getContentPane());
		hftrenokbtn.setIcon(new ImageIcon(hftrendlg.class.getResource("images/dlgok.png")));
		springLayout.putConstraint(SpringLayout.SOUTH, hftrenokbtn, -10, SpringLayout.SOUTH, getContentPane());
		getContentPane().add(hftrenokbtn);
		
		JButton hftrencanbtn = new JButton("");
		hftrencanbtn.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispose();
				hftnewnamebox.setText(null);
			}
		});
		hftrencanbtn.setIcon(new ImageIcon(hftrendlg.class.getResource("images/dlgcan.png")));
		springLayout.putConstraint(SpringLayout.SOUTH, hftrencanbtn, -10, SpringLayout.SOUTH, getContentPane());
		springLayout.putConstraint(SpringLayout.EAST, hftrencanbtn, -10, SpringLayout.EAST, getContentPane());
		getContentPane().add(hftrencanbtn);
		setBackground(new Color(245, 255, 250));
		setTitle("Rename");
		setBounds(100, 100, 380, 160);


	}
	public JTextArea gethftnewnamebox() {
		return hftnewnamebox;
	}
}